//
//  HomePageUserNewsViewController.m
//  ShowYork
//
//  Created by hxh on 2020/9/29.
//  Copyright © 2020 hxh. All rights reserved.
//

#import "HomeUserInfoDynamicImageViewController.h"
#import "HomePageDetailViewController.h"
#import "HomePageUserNewsDateCell.h"
#import "HomePageUserDynamicImgViewCell.h"
#import "HomeUserInfoDynamicImageContentCell.h"
@interface HomeUserInfoDynamicImageViewController ()

@end

@implementation HomeUserInfoDynamicImageViewController


- (void)didUpdateToObject:(id)object{
    _model = object;
}

-(NSInteger)numberOfItems{
    return 2;
}

-(CGSize)sizeForItemAtIndex:(NSInteger)index{
    
    CGFloat height = 86;
    if (self.model.contentType.intValue == 3) {
        height = 114;
    };
    
    if (index == 1) {
        return CGSizeMake(kScreenW - 102, height);
    }
    return CGSizeMake(102,height);
}

-(UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index{
    
    if (index == 0) {
        HomePageUserDynamicImgViewCell *cell = [self.collectionContext dequeueReusableCellOfClass:[HomePageUserDynamicImgViewCell class] forSectionController:self atIndex:index];
        [cell setModel:self.model];
        return cell;
    }else {
        HomeUserInfoDynamicImageContentCell *cell = [self.collectionContext dequeueReusableCellOfClass:[HomeUserInfoDynamicImageContentCell class] forSectionController:self atIndex:index];
        [cell setModel:self.model];
        return cell;
    }
}

- (void)didSelectItemAtIndex:(NSInteger)index{
    if (self.showDetail) {
        self.showDetail(self.model);
    }
}


@end
